#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui>
#include <QLabel>
#include <QTimer>
#include <QDateTime>
#include "barmeter.h"
#include "decodethread.h"
#include "soundin.h"
#include "soundout.h"


//--------------------------------------------------------------------------
// MainWindow
//--------------------------------------------------------------------------
namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
  Q_OBJECT

public:
  explicit MainWindow(QWidget *parent = 0);
  ~MainWindow();
  bool m_network;                         //### Should use set/get ??

public slots:
  void showSoundInError(const QString& errorMsg);
  void showStatusMessage(const QString& statusMsg);
//  void dataSink(std::valarray<qint16> samples);
  void dataSink(int kb, int k);

protected:
  virtual void keyPressEvent( QKeyEvent *e );
  virtual bool eventFilter(QObject *object, QEvent *event);

private slots:
  void on_actionDeviceSetup_triggered();
  void on_monitorButton_clicked();
  void on_waterfallAvgSpinBox_valueChanged(int arg1);
  void on_actionExit_triggered();
  void on_actionAbout_triggered();
  void OnExit();
  void on_actionLinrad_triggered();
  void on_actionCuteSDR_triggered();
  void on_playButton_clicked();
  void on_txMuteButton_clicked();
  void on_abortButton_clicked();
  void on_zeroSpinBox_valueChanged(int arg1);
  void on_gainSpinBox_valueChanged(int arg1);

private:
    Ui::MainWindow *ui;
    qint32  m_SoundInIndex;
    qint32  m_SoundOutIndex;
    qint32  m_waterfallAvg;
    bool    m_go;
    QRect   m_wideGraphGeom;
    QLabel* lab1;                            // labels in status bar
    QLabel* lab2;
    QLabel* lab3;
    BarMeter *m_canvas;

    SoundInThread soundInThread;             //Instantiate the audio threads
    SoundOutThread soundOutThread;
    DecodeThread decodeThread;

    void readSettings();
    void writeSettings();
    void createStatusBar();
    void updateStatusBar();
};

extern "C" {
  void symspec_(int* kb, int* k, float* px, float* py, float s[],int* nkhz);
}

#endif // MAINWINDOW_H
